package com.spj;

import com.spj.dao.People;
import com.spj.facory.PeopleFactoryFourPrototype;
import com.spj.facory.PeopleFactoryFourSingleton;
import com.spj.impl.Japanese;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Main {
    public static void main(String[] args) throws Exception {
//        工厂一
//        People people=new PeopleFactory().getPeople("中国人");
//        工厂二
//        People people=new PeopleFactoryTwo().getPeople("中国人");
//        工厂三
//        PeopleFactoryThree factory = new PeopleFactoryThreeImpl();
//        People people = factory.getPeople();
//        people.eat();
//        工厂四
        People chinese = (People) PeopleFactoryFourPrototype.getBean("chinese");
        chinese.eat();
        Japanese japanese = (Japanese) PeopleFactoryFourPrototype.getBean("japanese");
        japanese.eat();
//        工厂四单例
//        People chinese = (People) PeopleFactoryFourSingleton.getBean("chinese");
//        chinese.eat();
//        Japanese japanese = (Japanese) PeopleFactoryFourSingleton.getBean("japanese");
//        japanese.eat();
//        SpringTest
//        BeanFactory factory = new XmlBeanFactory(new ClassPathResource("configContext.xml"));
//        People chinese = (People) factory.getBean("chinese");
//        chinese.eat();
//          System.out.println(1);
//        ApplicationContext applicationContext=new ClassPathXmlApplicationContext("configContext.xml");
//        Japanese j8 = applicationContext.getBean("j8", Japanese.class);
//        j8.eat();
    }
}
